package com.cloud.security.controller;

import com.cloud.common.domain.Result;
import com.cloud.entity.AuthBody;
import com.cloud.security.service.ISDKClientService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "SDK认证管理")
@RestController
@RequestMapping("/security/client")
public class SDKClientController {

    @Autowired
    private ISDKClientService authSDKService;

    @Operation(summary = "根据code获取浙政钉用户信息")
    @PostMapping("/inAuth/getDingGrantAuthInfo")
    public Result getDingGrantAuthInfo(@RequestBody AuthBody authBody) {
        return authSDKService.getDingGrantAuthInfo(authBody);
    }

    @Operation(summary = "根据code获取微信用户信息")
    @PostMapping("/inAuth/getWechatAuthInfo")
    public Result getWechatAuthInfo(@RequestBody AuthBody authBody) {
        return authSDKService.getWechatAuthInfo(authBody);
    }

    @Operation(summary = "根据code获取微信小程序用户信息")
    @PostMapping("/inAuth/getWechatMinAppInfo")
    public Result getWechatMinAppInfo(@RequestBody AuthBody authBody) {
        return authSDKService.getWechatMinAppInfo(authBody);
    }

    @Operation(summary = "根据code获取钉钉用户信息")
    @PostMapping("/inAuth/getDingTalkAuthInfo")
    public Result getDingTalkAuthInfo(@RequestBody AuthBody authBody) {
        return authSDKService.getDingTalkAuthInfo(authBody);
    }

}
